package com.chuangjiangx.member.coupon.ddd.domain.model;

import lombok.Getter;

/**
 * Created by zhoufushou on 2017/12/16.
 * 卡券类型
 */
@Getter
public enum MbrCouponType {
    CASH_COUPON("代金券", 1),
    ONSALE_COUPONS("折扣", 1),
    EXCHANGE_COUPON("兑换券", 3);

    public final String name;
    public final Integer code;

    MbrCouponType(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public static MbrCouponType getType(Integer code){
        for(MbrCouponType back : values()){
            if(back.code.equals(code)){
                return back;
            }
        }
        return null;
    }
}
